﻿/*******************************************************************
 *  Copyright(c) 2018-2018 A single spark
 *  All rights reserved.
 *
 *  文件名称:   yuvvideolistwidget.cpp
 *  简要描述:   用于播放列表的文件名和文件路径显示
 *
 *  创建日期:   2018.03.10
 *  作者:      Enum.Bai
 *  邮箱:      1040433764@qq.com
 *  说明:
 *
 *  修改日期:
 *  作者:
 *  邮箱:
 *  说明:
 ******************************************************************/

#ifndef YUVVIDEOLISTWIDGET_H
#define YUVVIDEOLISTWIDGET_H

#include "yuvwidget.h"

class QTreeWidget;
class QListWidget;
class QTreeWidgetItem;
class QAction;
class QMenu;

class YUVVideoListWidget : public YUVWidget
{
    Q_OBJECT
public:
    explicit YUVVideoListWidget(QWidget *parent = Q_NULLPTR);
    ~YUVVideoListWidget();

protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);

signals:
    void currentNameChanged(QString fileBaseName);

public slots:
    void updatePlayList(QString &filePath);
    void playListClicked(QTreeWidgetItem *item, int column);

private slots:
    void showTreeRightMenu(QPoint pos);
    void removeItem();
    void onCurrentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);

private:
    void initPlayList();
    void savePlayList(const QString &strPath);
    void removePlayList(const QString &baseName);

private:
    QTreeWidget *m_pPlayListWidgt;

    QMenu *m_pMenu;

    QAction *m_pDelAction;

};

#endif // YUVVIDEOLISTWIDGET_H
